
#include <stdio.h>
#include<string.h>
#include<unistd.h>
int main()
{
  //100个#号
#define NUM 100
  char bar[NUM+1];//多一个放\0
  //我们把数组全部设置成\0
  memset(bar,'\0',sizeof(bar));
  int i = 0;
  //标签数组
  const char lable[] = "|/-\\";
  while(i<=NUM){
   //打印数组 
    printf("[%-100s][%3d%%][%c]\r",bar,i,lable[i%4]);
    //立即刷新
    fflush(stdout);
    //进度条加加
    bar[i]='#';
    ++i;
    //5秒跑完
    usleep(50000);
  }
  printf("\n");
  return 0;
}
